Bubble Sort Visualizer

Visualize






Bubble Sort is a simple comparison-based sorting algorithm. It works by repeatedly stepping through the list, comparing adjacent elements and swapping them if they are in the wrong order. The pass through the list is repeated until no more swaps are needed, which means the list is sorted.

  1. Start with the first element and compare it with the next element. If the first element is greater than the second element, swap them.
  2. Move to the next pair of adjacent elements and repeat the comparison and swapping if necessary.
  3. Continue this process until the end of the array is reached.
  4. Repeat the above steps for each pass through the array until no more swaps are needed.

Complexity Analysis of Bubble Sort

Time Complexity: O(n²) in worst and average cases:

Usage Tips: